package backend.core.transport;

import org.apache.commons.codec.DecoderException;
import org.apache.commons.codec.binary.Hex;


public class Decoder {
    private Decoder() {
    }

    public static Decoder getInstance() {
        return Decoder.Container.instance;
    }

    static class Container {
        public static Decoder instance = new Decoder();

    }

    public String hexEncode(byte[] buf) {
        return Hex.encodeHexString(buf, true);
    }

    public byte[] hexDecode(String buf) throws DecoderException {
        return Hex.decodeHex(buf);
    }
}
